package com.example.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Set;

/**
 * 1. @ClassDescription:
 * 2. @author: Z
 * 3. @date: 2024年05月16日 1:57
 */
@Component
public class RedisUtil {

    @Autowired
    private RedisTemplate redisTemplate;

    public void cleanRedis(){
        Set<String> keys = redisTemplate.keys("*");
        for (String key : keys) {
            if(key.indexOf("order")!= -1)
                continue;
            redisTemplate.delete(key);
        }
    }
}
